All Questions
10 questions
1vote
5answers
934views
DTO vs POJO (Entity) on POST request
If I have for example a User POJO like the following @AllArgsConstructor public class User { @Id private final String id; private String username; private String password; private Date createdDate;...
0votes
1answer
348views
API Split for creating object with inheritance and behaviors
I have a web service which is exposed to UI owned by our team. This web service is responsible for creation of objects and saving it in the DB (NoSQL Database). The object being created has multiple ...
0votes
1answer
94views
Problems with software layers in complex query methods
I designed a rest api software with 2 simple layers: Controller and Service. The controller handles the coming http request and redirect to a service method. In the beginning of development every was ...
-1votes
1answer
752views
Exposing java service as static method or seam dependency
Our legacy application provide a static method public static boolean persist(Data data) for service/class callers for data persistence. I do see unit testing issue for callers. Is this also an ...
0votes
2answers
181views
How to write the following snippet in more cleaner way?
When the caller gives me a call, I need to evaluate n number of criteria which currently I'm doing like if (a & b & c & d & e) Day by day the conditions are growing and it's ...
1vote
1answer
841views
Have generic methods that transfer DTO's from different packages, but contain same fields
I have 3 services Service A, B, C which put and get data to/from Service D +============================================+ | Service A | Service B | Service C | +==============================...
1vote
2answers
163views
Is passing an ErrorMessage to be populated inside the receiving method an anti-pattern?
I come from a Java background, and my colleague is from .NET. We are working on a Java project and I saw him create a method like this: public Object myMethod(Object[] param1, ErrorMessage ...
6votes
6answers
5kviews
Should constructors ever be used only for side-effects?
Summary: Why is it wrong to design a constructor only for its side effects, and then to use the constructor without ever assigning its return value to a variable? I'm working on a project that ...
1vote
2answers
1kviews
Polymorphic constants in Java
I am designing some polymorphic code to perform mathematical operations. The idea is to abstract out the underlying representation of the data, as different use cases require different representations....
4votes
1answer
3kviews
Designing a flexible API with support for Callbacks
I am writing a Java library that needs to make http GET && POST requests. There will be two types of users of this library: Those with understanding of callbacks and know how to use them. ...